package team.yg.asset.config;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import team.yg.asset.interpector.LoginCheckInterceptor;

/**
 * 配置类
 * @author Eins
 * */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private LoginCheckInterceptor logInterceptor;

    /**
     * 注册登录拦截器
     * */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截所有请求，放行登录请求
        registry
                .addInterceptor(logInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login");
    }
}
